//
//  ZZHallController.m
//  NetesaeLottery
//
//  Created by 周英培 on 16/8/1.
//  Copyright © 2016年 周英培. All rights reserved.
//

#import "ZZHallController.h"

@interface ZZHallController ()

@property (nonatomic,weak) UIView *coverView;

@property (nonatomic,weak) UIImageView *imgView;

@end

@implementation ZZHallController

- (void)viewDidLoad {
    
    [super viewDidLoad];
    
    
}

- (IBAction)activityBtnClick:(id)sender {

    //MARK:遮罩
    UIView *coverView = [[UIView alloc] initWithFrame:[UIScreen mainScreen].bounds];
    
    coverView.backgroundColor = [UIColor blackColor];
    
    coverView.alpha = 0.3;
    
    [self.tabBarController.view addSubview:coverView];
    
    //MARK:图片
    UIImageView *imgView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"showActivity"]];
    
    imgView.center = self.tabBarController.view.center;
    
    imgView.userInteractionEnabled = YES;
    
    [self.tabBarController.view addSubview:imgView];
    
    //MARK:关闭按钮
    UIButton *closeBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    
    [closeBtn setImage:[UIImage imageNamed:@"alphaClose"] forState:UIControlStateNormal];
    
    [closeBtn sizeToFit];
    
    closeBtn.x = imgView.width - closeBtn.width;
    
    [imgView addSubview:closeBtn];
    
    [closeBtn addTarget:self action:@selector(close) forControlEvents:UIControlEventTouchUpInside];
    
    _coverView = coverView;
    
    _imgView = imgView;

}

- (void)close {

    [UIView animateWithDuration:0.5 animations:^{
        
        self.coverView.alpha = 0;
        
        self.imgView.alpha = 0;
        
    } completion:^(BOOL finished) {
        
        [self.coverView removeFromSuperview];
        
        [self.imgView removeFromSuperview];
        
    }];

}



@end
